home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / shllutil.lha / shellutils-1.8 / src / system.h < prev    next >
C/C++ Source or Header  |  1992-07-17  |  3KB  |  103 lines

  1. /* system-dependent definitions for shellutils programs.
  2.    Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* Include sys/types.h before this file.  */
  19.  
  20. #include <sys/stat.h>
  21. #ifndef S_ISREG            /* Doesn't have POSIX.1 stat stuff. */
  22. #define mode_t unsigned short
  23. #endif
  24. #ifndef S_IFMT
  25. #define S_IFMT 0170000
  26. #endif
  27. #if !defined(S_ISBLK) && defined(S_IFBLK)
  28. #define    S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  29. #endif
  30. #if !defined(S_ISCHR) && defined(S_IFCHR)
  31. #define    S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  32. #endif
  33. #if !defined(S_ISDIR) && defined(S_IFDIR)
  34. #define    S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  35. #endif
  36. #if !defined(S_ISREG) && defined(S_IFREG)
  37. #define    S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  38. #endif
  39. #if !defined(S_ISFIFO) && defined(S_IFIFO)
  40. #define    S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  41. #endif
  42. #if !defined(S_ISLNK) && defined(S_IFLNK)
  43. #define    S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  44. #endif
  45. #if !defined(S_ISSOCK) && defined(S_IFSOCK)
  46. #define    S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  47. #endif
  48. #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
  49. #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
  50. #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
  51. #endif
  52. #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
  53. #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
  54. #endif
  55.  
  56. #ifdef HAVE_UNISTD_H
  57. #include <unistd.h>
  58. #endif
  59.  
  60. #ifndef _POSIX_VERSION
  61. char *getlogin ();
  62. char *ttyname ();
  63. off_t lseek ();
  64. uid_t geteuid ();
  65. #endif /* _POSIX_VERSION */
  66.  
  67. #if defined(USG) || defined(STDC_HEADERS)
  68. #include <string.h>
  69. #define index strchr
  70. #define rindex strrchr
  71. #define bcopy(from, to, len) memcpy ((to), (from), (len))
  72. #define bzero(s, n) memset ((s), 0, (n))
  73. #else
  74. #include <strings.h>
  75. #endif
  76.  
  77. #include <errno.h>
  78. #ifdef STDC_HEADERS
  79. #include <stdlib.h>
  80. #else
  81. char *getenv ();
  82. double atof ();
  83. long atol ();
  84. extern int errno;
  85. #endif
  86.  
  87. #if defined(USG) || defined(_POSIX_VERSION)
  88. #include <fcntl.h>
  89. #else /* not (USG or _POSIX_VERSION) */
  90. #include <sys/file.h>
  91. #endif /* USG or _POSIX_VERSION */
  92.  
  93. #ifndef F_OK
  94. #define F_OK 0
  95. #define X_OK 1
  96. #define W_OK 2
  97. #define R_OK 4
  98. #endif
  99.  
  100. #ifndef S_ISLNK
  101. #define lstat stat
  102. #endif
  103.